package question2;

import java.util.ArrayList;
import java.util.List;

public class LCR77 {

    static List<List<Integer>> result = new ArrayList<>();

    public static void main(String[] args) {
        int n = 4, k = 2;
        List<Integer> list = new ArrayList<>();
        backTracking(1, k, n, list);
        System.out.println(result.size());
    }

    public static void backTracking(int start, int k, int n, List<Integer> list) {
        if (list.size() == k) {
            result.add(new ArrayList<>(list));
            return;
        }
        for (int i = start; i <= n; i++) {
            list.add(i);
            backTracking(i + 1, k, n, list);
            list.remove(list.size() - 1);
        }
    }
}
